package com.czxy.Test;

import com.czxy.domain.Product;
import com.czxy.service.ProductService;
import com.github.pagehelper.PageInfo;

import java.util.List;

public class demo01 {
    public static void main(String[] args) {


        m03();

    }





    public  static  void m03(){

        ProductService service = new ProductService();

        PageInfo<Product> pageInfo = service.findByP(1,4);

        System.out.println("当前页的数据 ");

        List<Product> list = pageInfo.getList();
        for (Product p : list) {
            System.out.println(p);
        }

        System.out.println("---------");
        System.out.println("总共有多少条数据: "+pageInfo.getTotal());
        System.out.println("getPages: "+pageInfo.getPages());
        System.out.println("isIsFirstPage: "+pageInfo.isIsFirstPage());
        System.out.println("isIsLastPage: "+pageInfo.isIsLastPage());
    }





    public  static  void m02(){


        ProductService service = new ProductService();

        List<Product> list = service.findByPage(1,4);
        for (Product p : list) {
            System.out.println(p);
        }


    }
    public  static  void m01(){


        ProductService service = new ProductService();

        List<Product> list = service.findAll();
        for (Product p : list) {
            System.out.println(p);
        }


    }
}
